#include <iostream>
using namespace std;

class Person
{
public:
    Person()
    {
        cout << "Person构造函数\n";
    }
    virtual ~Person()
    {
        cout << "Person析构函数\n";
    }
    virtual void run()
    {
        cout << "Person run\n";
    }

public:
    int m_age;
};
class Student : public Person
{
public:
    Student()
    {
        cout << "Student 构造函数\n";
    }
    ~Student()
    {
        cout << "Student 析构函数\n";
    }
    void run()
    {
        cout << "Student run\n";
    }
    void study()
    {
        cout << "Student study\n";
    }

public:
    int m_score;
};
int main()
{
    // char *str = "hello world";
    /*const 转 非 const*/
    // char *buffer = const_cast<char *>(str);
    /*非const 转 const*/
    // const char *dest = static_cast<const char *>(str);

    // Person *p1 = new Student();
    // p1->run();
    // Person *p2 = new Person();
    // Student *stu2 = reinterpret_cast<Student *>(p2); /*没有安全检测*/
    // cout << stu2 << endl;
    // stu2->run();

    /*p=100=0x64*/
    int *p = reinterpret_cast<int *>(100);  
    cout << "p===" << p << endl;

    /*八字节转换成八字节*/
    int num = reinterpret_cast<long>(p);
    cout << "num===" << num << endl;
    return 0;
}